package ph.edu.ics.sp.graphisched.gui;

import java.awt.Window;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.JFrame;

import ph.edu.ics.sp.graphisched.GraphiSchedConstants;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class Main implements GraphiSchedConstants {

	private static void createAndShowGUI() {
		JFrame frame = new JFrame();
		WindowListener exitListener;

		exitListener = new WindowAdapter() {
			public void windowClosing(WindowEvent e) {
				Window window = e.getWindow();
				window.setVisible(false);
				window.dispose();
				System.exit(0);
			}
		};
		frame.addWindowListener(exitListener);
		JFrame.setDefaultLookAndFeelDecorated(true);
		frame.setTitle(APP_NAME);
		BufferedImage appIcon = null;
		try {
			appIcon = ImageIO.read(new File(new File("").getCanonicalPath()
					+ "\\res\\icons\\appicon.png"));

		} catch (IOException e) {
			e.printStackTrace();
		}

		frame.setIconImage(appIcon);
		frame.setContentPane(new GraphiSchedIndexPanel(frame));
		frame.setVisible(true);
		frame.setResizable(false);
		frame.pack();
		frame.setLocationRelativeTo(null);
		frame.repaint();
	}

	/**
	 * @param args
	 *            the command line arguments
	 */
	public static void main(String[] args) {
		// TODO code application logic here
		javax.swing.SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				createAndShowGUI();
			}
		});

	}

}